package com.xxx.fallback;

import com.xxx.domain.CourseUserLearn;
import com.xxx.feignclients.CourseUserLearnFeignClient;
import com.xxx.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseUserLearnFeignClientFallBack implements FallbackFactory<CourseUserLearnFeignClient> {
    @Override
    public CourseUserLearnFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new CourseUserLearnFeignClient() {
            @Override
            public JSONResult checkIsBuy(Long loginId, Long courseId) {
                return JSONResult.error("调用课程服务CourseController#checkIsBuy服务出错了!");
            }

            @Override
            public JSONResult saveOrUpdate(CourseUserLearn courseUserLearn) {
                return JSONResult.error("调用课程服务CourseController#saveOrUpdate服务出错了!");
            }
        };
    }
}
